import request from '../libs/request'


export const initCaptcha = () => {
  return request({
    url: `/common/captcha/init`,
    method: 'get'
  })
}



export const login = ({ username, password, captchaId, code }) => {

  const data = {
    username,
    password,
    captchaId,
    code
  }
  return request({
    url: `/login`,
    data,
    method: 'post'
  })
}

export const getUserInfo = token => {
  console.log('getUserInfo',token)
  return request({
    url: '/user/info',
    data: {
      token
    },
    method: 'get'
  })
}

export const logout = token => {
  return request({
    url: '/logout',
    method: 'post'
  })
}
